<template>
	<view>
		<view class='commission-details'>
			<view class='promoterHeader bg-color'>
				<view class='headerCon acea-row row-between-wrapper'>
					<view>
						<view class='name'>{{name}}</view>
						<!-- <view class='money'>￥<text class='num'>{{recordCount}}</text></view> -->
						<view class='money'>￥<text class='num'>{{userInfo.money_no}}</text></view>
						
					</view>
					<view class='iconfont icon-jinbi1'></view>
				</view>
			</view>
			<view class='sign-record'>
				<block v-for="(item,index) in recordList" :key="index" v-if="recordList.length>0">
					<view class='list'>
						<view class='item'>
							<!-- <view class='data'>{{item.time}}</view> -->
							<view class='listn'>
								<!-- <block v-for="(child,indexn) in item.list" :key="indexn"> -->
								<block >
									<view class='itemn acea-row row-between-wrapper'>
										<view>
											<view class='name line1'>{{item.title}}</view>
											<view>{{item.add_time}}</view>
										</view>
										<view class='num font-color'>{{item.money_true}}</view>
									</view>
								</block>
							</view>
						</view>
					</view>
				</block>
				<view v-if="recordList.length == 0">
					<emptyPage title='暂无记录~'></emptyPage>
				</view>
			</view>
		</view>
		<!-- #ifdef MP -->
		<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
		<!-- #endif -->
		<!-- 注释掉《按钮 --><!-- <home></home> -->
	</view>
</template>

<script>
	// import {
	// 	getCommissionInfoHas,
	// } from '@/api/user.js';
	import app from '@/App.vue';
	import {
		GYZJMODEL as gyzjModel
	} from '@/utils/gyzjModel.js'
	export default {
		data() {
			return {
				name: '',
				type: 2,
				page: 0,
				limit: 8,
				recordList: [],
				recordType: 0,
				recordCount: 0,
				status: false,
				isAuto: false, //没有授权的不会自动授权
				isShowAuth: false ,//是否隐藏授权
				extractCount:0,
				/*总页数*/
				pageCount:0,
				/*用户信息*/
				userInfo:[]
			};
		},
		onLoad(options) {
			var arr = this.main_getGlobal();
			this.getUserInfo(arr.token, arr.type);
		},
		onShow: function() {
			let type = 2;
			if (type == 1) {
				uni.setNavigationBarTitle({
					title: "提现记录"
				});
				this.name = '提现总额';
				this.recordType = 4;
				this.getRecordList();
				// this.getRecordListCount();
			} else if (type == 2) {
				uni.setNavigationBarTitle({
					title: "待结算"
				});
				this.name = '待结算';
				this.recordType = 3;
				this.getRecordList();
				// this.getRecordListCount();
			} else {
				uni.showToast({
					title: '参数错误',
					icon: 'none',
					duration: 1000,
					mask: true,
					success: function(res) {
						setTimeout(function() {
							// #ifndef H5
							uni.navigateBack({
								delta: 1,
							});
							// #endif
							// #ifdef H5
							history.back();
							// #endif

						}, 1200)
					},
				});
			}

		},
		methods: {
			// 获取个人信息
			getUserInfo: function(token, type) {
				console.log('方法进来token', token);
				console.log('方法进来type', type);
				let that=this;
				gyzjModel.prototype.getUserInfo(token, type).then(data => {
					console.log('data的值',data);
					switch (data.code) {
						case 1:
							var data = data.data.user;
							console.log('data的值',data);
							that.userInfo=data;
							break;
						default:
							uni.showToast({
								title: data.message,
								icon: 'none'
							})
							break;
					}
				})
			},
			onLoadFun() {
				this.getRecordList();
			},
			getRecordList: function() {
				let that = this;
				let page = that.page;
				let limit = that.limit;
				let status = that.status;
				let recordType = that.recordType;
				let recordList = that.recordList;
				let recordListNew = [];
				if (status == true) return;
				// getCommissionInfoHas({
				// 	page: page,
				// 	limit: limit
				// }, recordType).then(res => {
				// 	let len = res.data.list.length;
				// 	let recordListData = res.data.list;
				// 	recordListNew = recordList.concat(recordListData);
				// 	that.status = limit > len;
				// 	that.page = limit + page;
				// 	that.$set(that, 'recordList', recordListNew);
				// });
				var arr=that.main_getGlobal();
				var loadMore=false;
				gyzjModel.prototype.getCommissionInfoHas(arr.token, arr.type).then(res => {
					var recordList=res.data.data,lists;
					if (loadMore) {
						lists = lists.concat(recordList);
					} else {
						lists = recordList;
					}
					this.pageCount = res.data.page_count;
					that.$set(that, 'recordList', lists);
					console.log('type进来', arr.type);
					console.log('res的值',res);
					uni.hideLoading();
				})
				
			},
		},
		onReachBottom: function() {
			this.getRecordList();
		}
	}
</script>

<style >
	.commission-details .promoterHeader .headerCon .money {
		font-size: 36upx;
	}

	.commission-details .promoterHeader .headerCon .money .num {
		font-family: 'Guildford Pro';
	}
	/*新增样式*/
	.bg-color {
	    background-color: #e93323!important;
	}
	.promoterHeader {
	    width: 100%;
	    height: 220upx;
	}
	.promoterHeader .headerCon {
	    width: 100%;
	    height: 100%;
	    padding: 0 88upx 0 55upx;
	    -webkit-box-sizing: border-box;
	    box-sizing: border-box;
	    font-size: 28upx;
	    color: #fff;
	    background-image: url(…jSUWhLglYQiEh3Qv6+Qbj+Ep4XgPgYtBg/oRpiUhTF/wCwanlvn543fwAAAABJRU5ErkJggg==);
	    background-repeat: no-repeat;
	    background-size: 100% 100%;
	}
	.acea-row.row-between-wrapper {
	    -webkit-box-align: center;
	    -o-box-align: center;
	    -webkit-align-items: center;
	    align-items: center;
	    -webkit-box-pack: justify;
	    -o-box-pack: justify;
	    -webkit-justify-content: space-between;
	    justify-content: space-between;
	}
	.acea-row {
	    display: -webkit-box;
	    display: -webkit-flex;
	    display: flex;
	    -webkit-box-lines: multiple;
	    -moz-box-lines: multiple;
	    -o-box-lines: multiple;
	    -webkit-flex-wrap: wrap;
	    flex-wrap: wrap;
	}
	.promoterHeader .headerCon .iconfont {
	    font-size: 125upx;
	}
	.iconfont {
	    font-family: "iconfont" !important;
	    font-size: 16px;
	    font-style: normal;
	    -webkit-font-smoothing: antialiased;
	    -moz-osx-font-smoothing: grayscale;
	}
	.sign-record .list .item .data{height:80upx;line-height:80upx;padding:0 30upx;font-size:24upx;color:#666;}
	.sign-record .list .item .listn{background-color:#fff;font-size:24upx;color:#999;}
	.sign-record .list .item .listn .itemn{height:120upx;border-bottom:1upx solid #eee;padding-right:30upx;margin-left:30upx;}
	.sign-record .list .item .listn .itemn .name{
		width:390upx;
		font-size:28upx;
		color:#282828;
		margin-bottom:10upx;
		/*设置新的值*/
		text-overflow: ellipsis;//超出用...显示
		white-space: nowrap; //不换行
		overflow: hidden;    //超出隐藏
		}
	.sign-record .list .item .listn .itemn .num{font-size:36upx;font-family: 'Guildford Pro';color:#16ac57;}
</style>
